#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project: DataStructure-Python
@File: Selection-Sort.py
@Author: Dragon Geek
@Date: 2021/4/19 13:57
@Description:Selection Sort Algorithm
"""


def selection_sort(list_unsorted):
    """
    @param list_unsorted: the list that is unsorted in bubble sort algorithm
    @return: the list that has be sorted in bubble sort algorithm
    """
    n = len(list_unsorted)
    for i in range(n - 1):
        min_index = i
        for j in range(i + 1, n):
            if list_unsorted[min_index] > list_unsorted[j]:
                min_index = j
        list_unsorted[i], list_unsorted[min_index] = list_unsorted[min_index], list_unsorted[i]


if __name__ == "__main__":
    list_01 = [7000, 6, 5, 4, 3, 2, 1100, 14556, 465454, 1312, 1, 7987, 8, 87, 8]
    selection_sort(list_01)
    print(list_01)
